function update() {
    // 所有验证判断都通过后，执行保存操作
    var gameId = $('input[ name="gameId"]').val()
    var gameName = $('input[ name="gameName"]').val()
    var gamePrice = $('input[name="gamePrice"]').val()
    var gameIntroduction = $('textarea[ name="gameIntroduction"]').val()
    var gamePicture = $('input[ name="gamePicture"]')[0].files[0]
    var gtId = $('select[ name="gtId"]').val()
    var gameDiscount = $('input[ name="gameDiscount"]').val()
    var gameBody = $('input[ name="gameBody"]')[0].files[0]

    var formData = new FormData();
    // 把需要的参数拼一下\
    formData.append("gameId", gameId)
    formData.append("gameName", gameName)
    formData.append("gamePrice", gamePrice)
    formData.append("gameIntroduction", gameIntroduction)
    formData.append("gamePicture", gamePicture)
    formData.append("gtId", gtId)
    formData.append("gameDiscount", gameDiscount)
    formData.append("gameBody", gameBody)

    console.info(formData)
$.ajax({
    url:"/publishgame/updategame",
        type:"post",
        contentType:false,
        data:formData,
        dataType:"json",
        async:true,
        processData:false,
        success:function(resultData){
        console.log(resultData)
        if(resultData.code==1){
            alert("更新成功")
            location.href="../../mypublishgame.jsp"
        }else if(resultData.code==2){
            alert("更新失败")
        }

    }
})}

function clearNoNum(obj){
    obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
    obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
    obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
    obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
    if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过..................滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
        obj.value= parseFloat(obj.value);
    }
}